package com.basic;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.*;

public class JsonForm extends GenericServlet  
{
	private static final long serialVersionUID = 1L;
	BasicFactory bf=BasicFactory.getInstance();
	
	public String getSy(String ny)
	{
		String result="ny:"+ny;
		return result;
	}

	
	
	@Override
	public void service(ServletRequest request, ServletResponse response)throws ServletException, IOException 
	{
		String qyid=request.getParameter("qyid");
		String tableName=request.getParameter("tableName");
		String ny=request.getParameter("ny");
		String jlr="";
		String hbzj="";
		String xjqmye="";
		if(tableName.endsWith("gy"))
		{
			jlr=bf.querySy(qyid, ny);
			hbzj=bf.queryHbzj(qyid, ny);
			xjqmye=bf.queryHbzjQm(qyid, ny);
		}else if(tableName.endsWith("fylzz"))
		{
			hbzj=bf.queryHbzj(qyid, ny);
		}
		  PrintWriter pw = response.getWriter();
		  pw.println("{ \"jlr\": \""+jlr+"\", \"hbzj\":  \""+hbzj+"\", \"xjqmye\":  \""+xjqmye+"\"  }");

	}
	          
}
